package cn.jkgly.test.Controller;

import cn.jkgly.test.pojo.JSONResult;
import cn.jkgly.test.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class UserController {
    @RequestMapping("/user")
    @ResponseBody    //返回Json数据
    public Object hello() {
        User u = new User();
        u.setAge(18);
        u.setBrithday(new Date());
        u.setDesc("");
        u.setName("张三");
        u.setPassword("密码");
        return u;
    }

    @RequestMapping("/getUser")
    public JSONResult getUser() {
        User u = new User();
        u.setAge(44);
        u.setBrithday(new Date());
//        u.setDesc("测试1");
        u.setName("姓名1");
//        u.setPassword("密码");
        return JSONResult.ok(u);
    }
}
